package cc.yugu.yhdw.common.protocol.msg02;

import cc.yugu.yhdw.common.protocol.MsgCode;
import cc.yugu.yhdw.common.tool.netty.TypeOperator;
import io.netty.buffer.ByteBuf;

import java.util.ArrayList;
import java.util.List;

public class Msg022000024 extends Msg022 {
    public byte main;
    public int fullVolume;
    public byte imminentVolume;
    public List<Board> boardList = new ArrayList<Board>();

    @Override
    public int getMsgCode() {
        return MsgCode.MSG_022000024.getCode();
    }

    @Override
    public void writeData(ByteBuf buffer) {
        writeRtn(buffer);

        buffer.writeByte(main);
        buffer.writeInt(fullVolume);
        buffer.writeByte(imminentVolume);
        buffer.writeByte(boardList.size());
        for(Board e : boardList) {
            e.write(buffer);
        }
    }

    public static class Board extends TypeOperator {

        public byte num;
        public byte fullCount;

        public void write(ByteBuf buffer) {
            buffer.writeByte(num);
            buffer.writeByte(fullCount);
        }
    }
}
